﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeDom
{
  class Program
  {

    static void Main(string[] args)
    {
      string domain = args[0];
      string userName = args[1];
      string password = args[2];
      string rootPath = args[3];
      string baseNamespace = args[4];
      string outputFile = args[5];

      SitecoreConnection connection = new SitecoreConnection(string.Format("http://{0}/sitecore/shell/WebService/Service.asmx", domain), userName, password);

      TemplatesFileGenerator generator = new TemplatesFileGenerator(baseNamespace, rootPath);
      IEnumerable<Template> templates = connection.GetTemplates(rootPath);

      generator.Generate(templates, outputFile);
      //new SampleCodeDom.Sample().Generate();
      Console.WriteLine(outputFile + " was generated");
      Console.ReadKey();
    }
  }
}
